﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Numeria.IO
{
    internal class MimeTypeConverter
    {
        public static string Convert(string extension)
        {
            var ext = extension.Replace(".", "").ToLower();
            var r = string.Empty;

            switch (ext)
            {
                case "3dm": r = "x-world/x-3dmf"; break;
                case "3dmf": r = "x-world/x-3dmf"; break;
                case "a": r = "application/octet-stream"; break;
                case "aab": r = "application/x-authorware-bin"; break;
                case "aam": r = "application/x-authorware-map"; break;
                case "aas": r = "application/x-authorware-seg"; break;
                case "abc": r = "text/vnd.abc"; break;
                case "acgi": r = "text/html"; break;
                case "afl": r = "video/animaflex"; break;
                case "ai": r = "application/postscript"; break;
                case "aif": r = "audio/aiff"; break;
                case "aifc": r = "audio/aiff"; break;
                case "aiff": r = "audio/aiff"; break;
                case "aim": r = "application/x-aim"; break;
                case "aip": r = "text/x-audiosoft-intra"; break;
                case "ani": r = "application/x-navi-animation"; break;
                case "aos": r = "application/x-nokia-9000-communicator-add-on-software"; break;
                case "aps": r = "application/mime"; break;
                case "arc": r = "application/octet-stream"; break;
                case "arj": r = "application/arj"; break;
                case "art": r = "image/x-jg"; break;
                case "asf": r = "video/x-ms-asf"; break;
                case "asm": r = "text/x-asm"; break;
                case "asp": r = "text/asp"; break;
                case "asx": r = "video/x-ms-asf"; break;
                case "au": r = "audio/basic"; break;
                case "avi": r = "video/avi"; break;
                case "avs": r = "video/avs-video"; break;
                case "bcpio": r = "application/x-bcpio"; break;
                case "bin": r = "application/octet-stream"; break;
                case "bm": r = "image/bmp"; break;
                case "bmp": r = "image/bmp"; break;
                case "boo": r = "application/book"; break;
                case "book": r = "application/book"; break;
                case "boz": r = "application/x-bzip2"; break;
                case "bsh": r = "application/x-bsh"; break;
                case "bz": r = "application/x-bzip"; break;
                case "bz2": r = "application/x-bzip2"; break;
                case "c": r = "text/plain"; break;
                case "c++": r = "text/plain"; break;
                case "cat": r = "application/vnd.ms-pki.seccat"; break;
                case "cc": r = "text/plain"; break;
                case "ccad": r = "application/clariscad"; break;
                case "cco": r = "application/x-cocoa"; break;
                case "cdf": r = "application/cdf"; break;
                case "cer": r = "application/pkix-cert"; break;
                case "cha": r = "application/x-chat"; break;
                case "chat": r = "application/x-chat"; break;
                case "class": r = "application/java"; break;
                case "com": r = "application/octet-stream"; break;
                case "conf": r = "text/plain"; break;
                case "cpio": r = "application/x-cpio"; break;
                case "cpp": r = "text/x-c"; break;
                case "cpt": r = "application/x-cpt"; break;
                case "crl": r = "application/pkcs-crl"; break;
                case "crt": r = "application/pkix-cert"; break;
                case "csh": r = "application/x-csh"; break;
                case "css": r = "text/css"; break;
                case "cxx": r = "text/plain"; break;
                case "dcr": r = "application/x-director"; break;
                case "deepv": r = "application/x-deepv"; break;
                case "def": r = "text/plain"; break;
                case "der": r = "application/x-x509-ca-cert"; break;
                case "dif": r = "video/x-dv"; break;
                case "dir": r = "application/x-director"; break;
                case "dl": r = "video/dl"; break;
                case "doc": r = "application/msword"; break;
                case "dot": r = "application/msword"; break;
                case "dp": r = "application/commonground"; break;
                case "drw": r = "application/drafting"; break;
                case "dump": r = "application/octet-stream"; break;
                case "dv": r = "video/x-dv"; break;
                case "dvi": r = "application/x-dvi"; break;
                case "dwf": r = "model/vnd.dwf"; break;
                case "dwg": r = "image/vnd.dwg"; break;
                case "dxf": r = "image/vnd.dwg"; break;
                case "dxr": r = "application/x-director"; break;
                case "el": r = "text/x-script.elisp"; break;
                case "elc": r = "application/x-elc"; break;
                case "env": r = "application/x-envoy"; break;
                case "eps": r = "application/postscript"; break;
                case "es": r = "application/x-esrehber"; break;
                case "etx": r = "text/x-setext"; break;
                case "evy": r = "application/envoy"; break;
                case "exe": r = "application/octet-stream"; break;
                case "f": r = "text/plain"; break;
                case "f77": r = "text/x-fortran"; break;
                case "f90": r = "text/plain"; break;
                case "fdf": r = "application/vnd.fdf"; break;
                case "fif": r = "image/fif"; break;
                case "fli": r = "video/fli"; break;
                case "flo": r = "image/florian"; break;
                case "flx": r = "text/vnd.fmi.flexstor"; break;
                case "fmf": r = "video/x-atomic3d-feature"; break;
                case "for": r = "text/x-fortran"; break;
                case "fpx": r = "image/vnd.fpx"; break;
                case "frl": r = "application/freeloader"; break;
                case "funk": r = "audio/make"; break;
                case "g": r = "text/plain"; break;
                case "g3": r = "image/g3fax"; break;
                case "gif": r = "image/gif"; break;
                case "gl": r = "video/gl"; break;
                case "gsd": r = "audio/x-gsm"; break;
                case "gsm": r = "audio/x-gsm"; break;
                case "gsp": r = "application/x-gsp"; break;
                case "gss": r = "application/x-gss"; break;
                case "gtar": r = "application/x-gtar"; break;
                case "gz": r = "application/x-gzip"; break;
                case "gzip": r = "application/x-gzip"; break;
                case "h": r = "text/plain"; break;
                case "hdf": r = "application/x-hdf"; break;
                case "help": r = "application/x-helpfile"; break;
                case "hgl": r = "application/vnd.hp-hpgl"; break;
                case "hh": r = "text/plain"; break;
                case "hlb": r = "text/x-script"; break;
                case "hlp": r = "application/hlp"; break;
                case "hpg": r = "application/vnd.hp-hpgl"; break;
                case "hpgl": r = "application/vnd.hp-hpgl"; break;
                case "hqx": r = "application/binhex"; break;
                case "hta": r = "application/hta"; break;
                case "htc": r = "text/x-component"; break;
                case "htm": r = "text/html"; break;
                case "html": r = "text/html"; break;
                case "htmls": r = "text/html"; break;
                case "htt": r = "text/webviewhtml"; break;
                case "htx": r = "text/html"; break;
                case "ice": r = "x-conference/x-cooltalk"; break;
                case "ico": r = "image/x-icon"; break;
                case "idc": r = "text/plain"; break;
                case "ief": r = "image/ief"; break;
                case "iefs": r = "image/ief"; break;
                case "iges": r = "application/iges"; break;
                case "igs": r = "application/iges"; break;
                case "ima": r = "application/x-ima"; break;
                case "imap": r = "application/x-httpd-imap"; break;
                case "inf": r = "application/inf"; break;
                case "ins": r = "application/x-internett-signup"; break;
                case "ip": r = "application/x-ip2"; break;
                case "isu": r = "video/x-isvideo"; break;
                case "it": r = "audio/it"; break;
                case "iv": r = "application/x-inventor"; break;
                case "ivr": r = "i-world/i-vrml"; break;
                case "ivy": r = "application/x-livescreen"; break;
                case "jam": r = "audio/x-jam"; break;
                case "jav": r = "text/plain"; break;
                case "java": r = "text/plain"; break;
                case "jcm": r = "application/x-java-commerce"; break;
                case "jfif": r = "image/jpeg"; break;
                case "jfif-tbnl": r = "image/jpeg"; break;
                case "jpe": r = "image/jpeg"; break;
                case "jpeg": r = "image/jpeg"; break;
                case "jpg": r = "image/jpeg"; break;
                case "jps": r = "image/x-jps"; break;
                case "js": r = "application/x-javascript"; break;
                case "jut": r = "image/jutvision"; break;
                case "kar": r = "audio/midi"; break;
                case "ksh": r = "application/x-ksh"; break;
                case "la": r = "audio/nspaudio"; break;
                case "lam": r = "audio/x-liveaudio"; break;
                case "latex": r = "application/x-latex"; break;
                case "lha": r = "application/octet-stream"; break;
                case "lhx": r = "application/octet-stream"; break;
                case "list": r = "text/plain"; break;
                case "lma": r = "audio/nspaudio"; break;
                case "log": r = "text/plain"; break;
                case "lsp": r = "application/x-lisp"; break;
                case "lst": r = "text/plain"; break;
                case "lsx": r = "text/x-la-asf"; break;
                case "ltx": r = "application/x-latex"; break;
                case "lzh": r = "application/octet-stream"; break;
                case "lzx": r = "application/octet-stream"; break;
                case "m": r = "text/plain"; break;
                case "m1v": r = "video/mpeg"; break;
                case "m2a": r = "audio/mpeg"; break;
                case "m2v": r = "video/mpeg"; break;
                case "m3u": r = "audio/x-mpequrl"; break;
                case "man": r = "application/x-troff-man"; break;
                case "map": r = "application/x-navimap"; break;
                case "mar": r = "text/plain"; break;
                case "mbd": r = "application/mbedlet"; break;
                case "mc$": r = "application/x-magic-cap-package-1.0"; break;
                case "mcd": r = "application/mcad"; break;
                case "mcf": r = "text/mcf"; break;
                case "mcp": r = "application/netmc"; break;
                case "me": r = "application/x-troff-me"; break;
                case "mht": r = "message/rfc822"; break;
                case "mhtml": r = "message/rfc822"; break;
                case "mid": r = "audio/midi"; break;
                case "midi": r = "audio/midi"; break;
                case "mif": r = "application/x-mif"; break;
                case "mime": r = "message/rfc822"; break;
                case "mjf": r = "audio/x-vnd.audioexplosion.mjuicemediafile"; break;
                case "mjpg": r = "video/x-motion-jpeg"; break;
                case "mm": r = "application/base64"; break;
                case "mme": r = "application/base64"; break;
                case "mod": r = "audio/mod"; break;
                case "moov": r = "video/quicktime"; break;
                case "mov": r = "video/quicktime"; break;
                case "movie": r = "video/x-sgi-movie"; break;
                case "mp2": r = "audio/mpeg"; break;
                case "mp3": r = "audio/mpeg"; break;
                case "mpa": r = "audio/mpeg"; break;
                case "mpc": r = "application/x-project"; break;
                case "mpe": r = "video/mpeg"; break;
                case "mpeg": r = "video/mpeg"; break;
                case "mpg": r = "video/mpeg"; break;
                case "mpga": r = "audio/mpeg"; break;
                case "mpp": r = "application/vnd.ms-project"; break;
                case "mpt": r = "application/vnd.ms-project"; break;
                case "mpv": r = "application/vnd.ms-project"; break;
                case "mpx": r = "application/vnd.ms-project"; break;
                case "mrc": r = "application/marc"; break;
                case "ms": r = "application/x-troff-ms"; break;
                case "mv": r = "video/x-sgi-movie"; break;
                case "my": r = "audio/make"; break;
                case "mzz": r = "application/x-vnd.audioexplosion.mzz"; break;
                case "nap": r = "image/naplps"; break;
                case "naplps": r = "image/naplps"; break;
                case "nc": r = "application/x-netcdf"; break;
                case "ncm": r = "application/vnd.nokia.configuration-message"; break;
                case "nif": r = "image/x-niff"; break;
                case "niff": r = "image/x-niff"; break;
                case "nix": r = "application/x-mix-transfer"; break;
                case "nsc": r = "application/x-conference"; break;
                case "nvd": r = "application/x-navidoc"; break;
                case "o": r = "application/octet-stream"; break;
                case "oda": r = "application/oda"; break;
                case "omc": r = "application/x-omc"; break;
                case "omcd": r = "application/x-omcdatamaker"; break;
                case "omcr": r = "application/x-omcregerator"; break;
                case "p": r = "text/x-pascal"; break;
                case "p10": r = "application/pkcs10"; break;
                case "p12": r = "application/pkcs-12"; break;
                case "p7a": r = "application/x-pkcs7-signature"; break;
                case "p7c": r = "application/pkcs7-mime"; break;
                case "p7m": r = "application/pkcs7-mime"; break;
                case "p7r": r = "application/x-pkcs7-certreqresp"; break;
                case "p7s": r = "application/pkcs7-signature"; break;
                case "part": r = "application/pro_eng"; break;
                case "pas": r = "text/pascal"; break;
                case "pbm": r = "image/x-portable-bitmap"; break;
                case "pcl": r = "application/vnd.hp-pcl"; break;
                case "pct": r = "image/x-pict"; break;
                case "pcx": r = "image/x-pcx"; break;
                case "pdb": r = "chemical/x-pdb"; break;
                case "pdf": r = "application/pdf"; break;
                case "pfunk": r = "audio/make"; break;
                case "pgm": r = "image/x-portable-greymap"; break;
                case "pic": r = "image/pict"; break;
                case "pict": r = "image/pict"; break;
                case "pkg": r = "application/x-newton-compatible-pkg"; break;
                case "pko": r = "application/vnd.ms-pki.pko"; break;
                case "pl": r = "text/plain"; break;
                case "plx": r = "application/x-pixclscript"; break;
                case "pm": r = "image/x-xpixmap"; break;
                case "pm4": r = "application/x-pagemaker"; break;
                case "pm5": r = "application/x-pagemaker"; break;
                case "png": r = "image/png"; break;
                case "pnm": r = "application/x-portable-anymap"; break;
                case "pot": r = "application/vnd.ms-powerpoint"; break;
                case "pov": r = "model/x-pov"; break;
                case "ppa": r = "application/vnd.ms-powerpoint"; break;
                case "ppm": r = "image/x-portable-pixmap"; break;
                case "pps": r = "application/vnd.ms-powerpoint"; break;
                case "ppt": r = "application/vnd.ms-powerpoint"; break;
                case "ppz": r = "application/vnd.ms-powerpoint"; break;
                case "pre": r = "application/x-freelance"; break;
                case "prt": r = "application/pro_eng"; break;
                case "ps": r = "application/postscript"; break;
                case "psd": r = "application/octet-stream"; break;
                case "pvu": r = "paleovu/x-pv"; break;
                case "pwz": r = "application/vnd.ms-powerpoint"; break;
                case "py": r = "text/x-script.phyton"; break;
                case "pyc": r = "applicaiton/x-bytecode.python"; break;
                case "qcp": r = "audio/vnd.qcelp"; break;
                case "qd3": r = "x-world/x-3dmf"; break;
                case "qd3d": r = "x-world/x-3dmf"; break;
                case "qif": r = "image/x-quicktime"; break;
                case "qt": r = "video/quicktime"; break;
                case "qtc": r = "video/x-qtc"; break;
                case "qti": r = "image/x-quicktime"; break;
                case "qtif": r = "image/x-quicktime"; break;
                case "ra": r = "audio/x-pn-realaudio"; break;
                case "ram": r = "audio/x-pn-realaudio"; break;
                case "ras": r = "application/x-cmu-raster"; break;
                case "rast": r = "image/cmu-raster"; break;
                case "rexx": r = "text/x-script.rexx"; break;
                case "rf": r = "image/vnd.rn-realflash"; break;
                case "rgb": r = "image/x-rgb"; break;
                case "rm": r = "application/vnd.rn-realmedia"; break;
                case "rmi": r = "audio/mid"; break;
                case "rmm": r = "audio/x-pn-realaudio"; break;
                case "rmp": r = "audio/x-pn-realaudio"; break;
                case "rng": r = "application/ringing-tones"; break;
                case "rnx": r = "application/vnd.rn-realplayer"; break;
                case "roff": r = "application/x-troff"; break;
                case "rp": r = "image/vnd.rn-realpix"; break;
                case "rpm": r = "audio/x-pn-realaudio-plugin"; break;
                case "rt": r = "text/richtext"; break;
                case "rtf": r = "text/richtext"; break;
                case "rtx": r = "text/richtext"; break;
                case "rv": r = "video/vnd.rn-realvideo"; break;
                case "s": r = "text/x-asm"; break;
                case "s3m": r = "audio/s3m"; break;
                case "saveme": r = "application/octet-stream"; break;
                case "sbk": r = "application/x-tbook"; break;
                case "scm": r = "application/x-lotusscreencam"; break;
                case "sdml": r = "text/plain"; break;
                case "sdp": r = "application/sdp"; break;
                case "sdr": r = "application/sounder"; break;
                case "sea": r = "application/sea"; break;
                case "set": r = "application/set"; break;
                case "sgm": r = "text/sgml"; break;
                case "sgml": r = "text/sgml"; break;
                case "sh": r = "application/x-sh"; break;
                case "shar": r = "application/x-shar"; break;
                case "shtml": r = "text/html"; break;
                case "sid": r = "audio/x-psid"; break;
                case "sit": r = "application/x-sit"; break;
                case "skd": r = "application/x-koan"; break;
                case "skm": r = "application/x-koan"; break;
                case "skp": r = "application/x-koan"; break;
                case "skt": r = "application/x-koan"; break;
                case "sl": r = "application/x-seelogo"; break;
                case "smi": r = "application/smil"; break;
                case "smil": r = "application/smil"; break;
                case "snd": r = "audio/basic"; break;
                case "sol": r = "application/solids"; break;
                case "spc": r = "text/x-speech"; break;
                case "spl": r = "application/futuresplash"; break;
                case "spr": r = "application/x-sprite"; break;
                case "sprite": r = "application/x-sprite"; break;
                case "src": r = "application/x-wais-source"; break;
                case "ssi": r = "text/x-server-parsed-html"; break;
                case "ssm": r = "application/streamingmedia"; break;
                case "sst": r = "application/vnd.ms-pki.certstore"; break;
                case "step": r = "application/step"; break;
                case "stl": r = "application/sla"; break;
                case "stp": r = "application/step"; break;
                case "sv4cpio": r = "application/x-sv4cpio"; break;
                case "sv4crc": r = "application/x-sv4crc"; break;
                case "svf": r = "image/vnd.dwg"; break;
                case "svr": r = "application/x-world"; break;
                case "swf": r = "application/x-shockwave-flash"; break;
                case "t": r = "application/x-troff"; break;
                case "talk": r = "text/x-speech"; break;
                case "tar": r = "application/x-tar"; break;
                case "tbk": r = "application/toolbook"; break;
                case "tcl": r = "application/x-tcl"; break;
                case "tcsh": r = "text/x-script.tcsh"; break;
                case "tex": r = "application/x-tex"; break;
                case "texi": r = "application/x-texinfo"; break;
                case "texinfo": r = "application/x-texinfo"; break;
                case "text": r = "text/plain"; break;
                case "tgz": r = "application/x-compressed"; break;
                case "tif": r = "image/tiff"; break;
                case "tiff": r = "image/tiff"; break;
                case "tr": r = "application/x-troff"; break;
                case "tsi": r = "audio/tsp-audio"; break;
                case "tsp": r = "application/dsptype"; break;
                case "tsv": r = "text/tab-separated-values"; break;
                case "turbot": r = "image/florian"; break;
                case "txt": r = "text/plain"; break;
                case "uil": r = "text/x-uil"; break;
                case "uni": r = "text/uri-list"; break;
                case "unis": r = "text/uri-list"; break;
                case "unv": r = "application/i-deas"; break;
                case "uri": r = "text/uri-list"; break;
                case "uris": r = "text/uri-list"; break;
                case "ustar": r = "application/x-ustar"; break;
                case "uu": r = "application/octet-stream"; break;
                case "uue": r = "text/x-uuencode"; break;
                case "vcd": r = "application/x-cdlink"; break;
                case "vcs": r = "text/x-vcalendar"; break;
                case "vda": r = "application/vda"; break;
                case "vdo": r = "video/vdo"; break;
                case "vew": r = "application/groupwise"; break;
                case "viv": r = "video/vivo"; break;
                case "vivo": r = "video/vivo"; break;
                case "vmd": r = "application/vocaltec-media-desc"; break;
                case "vmf": r = "application/vocaltec-media-file"; break;
                case "voc": r = "audio/voc"; break;
                case "vos": r = "video/vosaic"; break;
                case "vox": r = "audio/voxware"; break;
                case "vqe": r = "audio/x-twinvq-plugin"; break;
                case "vqf": r = "audio/x-twinvq"; break;
                case "vql": r = "audio/x-twinvq-plugin"; break;
                case "vrml": r = "application/x-vrml"; break;
                case "vrt": r = "x-world/x-vrt"; break;
                case "vsd": r = "application/x-visio"; break;
                case "vst": r = "application/x-visio"; break;
                case "vsw": r = "application/x-visio"; break;
                case "w60": r = "application/wordperfect6.0"; break;
                case "w61": r = "application/wordperfect6.1"; break;
                case "w6w": r = "application/msword"; break;
                case "wav": r = "audio/wav"; break;
                case "wb1": r = "application/x-qpro"; break;
                case "wbmp": r = "image/vnd.wap.wbmp"; break;
                case "web": r = "application/vnd.xara"; break;
                case "wiz": r = "application/msword"; break;
                case "wk1": r = "application/x-123"; break;
                case "wmf": r = "windows/metafile"; break;
                case "wml": r = "text/vnd.wap.wml"; break;
                case "wmlc": r = "application/vnd.wap.wmlc"; break;
                case "wmls": r = "text/vnd.wap.wmlscript"; break;
                case "wmlsc": r = "application/vnd.wap.wmlscriptc"; break;
                case "word": r = "application/msword"; break;
                case "wp": r = "application/wordperfect"; break;
                case "wp5": r = "application/wordperfect"; break;
                case "wp6": r = "application/wordperfect"; break;
                case "wpd": r = "application/wordperfect"; break;
                case "wq1": r = "application/x-lotus"; break;
                case "wri": r = "application/mswrite"; break;
                case "wrl": r = "application/x-world"; break;
                case "wrz": r = "x-world/x-vrml"; break;
                case "wsc": r = "text/scriplet"; break;
                case "wsrc": r = "application/x-wais-source"; break;
                case "wtk": r = "application/x-wintalk"; break;
                case "xbm": r = "image/x-xbitmap"; break;
                case "xdr": r = "video/x-amt-demorun"; break;
                case "xgz": r = "xgl/drawing"; break;
                case "xif": r = "image/vnd.xiff"; break;
                case "xl": r = "application/excel"; break;
                case "xla": r = "application/vnd.ms-excel"; break;
                case "xlb": r = "application/vnd.ms-excel"; break;
                case "xlc": r = "application/vnd.ms-excel"; break;
                case "xld": r = "application/vnd.ms-excel"; break;
                case "xlk": r = "application/vnd.ms-excel"; break;
                case "xll": r = "application/vnd.ms-excel"; break;
                case "xlm": r = "application/vnd.ms-excel"; break;
                case "xls": r = "application/vnd.ms-excel"; break;
                case "xlt": r = "application/vnd.ms-excel"; break;
                case "xlv": r = "application/vnd.ms-excel"; break;
                case "xlw": r = "application/vnd.ms-excel"; break;
                case "xm": r = "audio/xm"; break;
                case "xml": r = "application/xml"; break;
                case "xmz": r = "xgl/movie"; break;
                case "xpix": r = "application/x-vnd.ls-xpix"; break;
                case "xpm": r = "image/xpm"; break;
                case "x-png": r = "image/png"; break;
                case "xsr": r = "video/x-amt-showrun"; break;
                case "xwd": r = "image/x-xwd"; break;
                case "xyz": r = "chemical/x-pdb"; break;
                case "z": r = "application/x-compressed"; break;
                case "zip": r = "application/zip"; break;
                case "zoo": r = "application/octet-stream"; break;
                case "zsh": r = "text/x-script.zsh"; break;
                default: r = "application/octet-stream"; break;
            }
            return r;
        }
    }
}
